﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		IEmailService.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 //   File:            IEmailService.cs
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Dexter.Core.EventArgs;
using Dexter.Domain.Model;

namespace Dexter.Services {
	public interface IEmailService {
		
		/// <summary>
		/// 	Queues the specified email into dispatcher list.
		/// </summary>
		/// <param name = "item">The item.</param>
		void Queue ( EmailMessage item );

		///<summary>
		///	Peeks a set of <c>EmailMessage</c> from the queue.
		///</summary>
		///<param name = "size">The size of return's array.</param>
		///<returns>
		///	An array of <c>EmailMessage</c>.
		///	The return object could be null if there isn't items into it.
		///</returns>
		IEnumerable <EmailMessage> Peek ( int size );

		/// <summary>
		/// 	The lifecycle of the item is completed, so this method removes it from the repository.
		/// </summary>
		/// <param name = "item">The item to remove.</param>
		void Dequeue ( EmailMessage item );

		/// <summary>
		/// This event will raise when a <see cref="EmailMessage"/> will be deleted by the implementation of <see cref="Peek(int)"/>.
		/// </summary>
		event EventHandler<GenericEventArgs<IEnumerable<EmailMessage>>> EmailsPeeked;

		/// <summary>
		/// This event will raise when a <see cref="EmailMessage"/> will be deleted by the implementation of <see cref="Queue(EmailMessage)"/>.
		/// </summary>
		event EventHandler<GenericEventArgs<EmailMessage>> EmailQueued;

		/// <summary>
		/// This event will raise before a <see cref="EmailMessage"/> will deleted by the implementation of <see cref="Queue(EmailMessage)"/>.
		/// </summary>
		event EventHandler<CancelEventArgs> EmailQueueing;

		/// <summary>
		/// This event will raise when a <see cref="EmailMessage"/> will be deleted by the implementation of <see cref="Dequeue(EmailMessage)"/>.
		/// </summary>
		event EventHandler<GenericEventArgs<EmailMessage>> EmailDequeued;

		/// <summary>
		/// This event will raise before a <see cref="EmailMessage"/> will deleted by the implementation of <see cref="Dequeue(EmailMessage)"/>.
		/// </summary>
		event EventHandler<CancelEventArgs> EmailDequeueing;
	}
}
